﻿using SUNRPA.CONTROLS.IMPL.domain;
using SUNRPA.CONTROLS.IMPL.domain.flowItemParam;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using System.Collections.Concurrent;

namespace SUNRPA.CONTROLS.IMPL.controls {
    public class ElseNAction:BaseControlActions {
        public override int Execute(int currentIndex, FlowItem item, ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData, List<FlowItem> flowItems) {
            ElseNParam? param = item.ControlParam as ElseNParam;
            for(int j = currentIndex + 1; j < item.EndTag.Index; j++) {
                BaseControlActions.updateInfoDelegate(j);
                j = ExecuteAction(flowItems[j], globleData, flowItems);
            }
            return item.EndTag.Index - 1;
        }
    }
}
